package xkp.lesson2;

import org.junit.Test;

import xkp.lesson1.Children;
import xkp.lesson1.Person;
import xkp.lesson1.Student;
import xkp.lesson1.Teacher;

public class Demo1 {

	@Test
	public void test1() {
		Person person = new Person();
		person.say();
		person = new Children();
		person.say();
		person = new Teacher();
		person.say();
		person = new Student();
		person.say();

		/*
		 * person1.say(); person2.say(); person3.say(); person4.say();
		 */
		/*
		 * fun1(person); fun1(children); fun1(teacher); fun1(student);
		 */
	}

	//此处如果有多态配合，效果更好
	public void fun1(Person person) {
		person.say();
	}

	/*
	 * public void fun1(Children person) {
	 * 
	 * }
	 * 
	 * public void fun1(Teacher person) {
	 * 
	 * }
	 * 
	 * public void fun1(Student person) {
	 * 
	 * }
	 */
}
